package com.example.javafx.按钮;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.effect.DropShadow;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class Main_1 extends Application {

    DropShadow shadow = new DropShadow();

    @Override
    public void start(Stage primaryStage) throws Exception {
        Scene scene = new Scene(new Group());
        primaryStage.setTitle("Button Sample");
        primaryStage.setWidth(300);
        primaryStage.setHeight(190);

        VBox vBox = new VBox();
        vBox.setLayoutX(20);
        vBox.setLayoutY(20);

        final Button button1 = new Button("Accept");
        button1.addEventHandler(MouseEvent.MOUSE_ENTERED, event -> button1.setEffect(shadow));

        button1.addEventHandler(MouseEvent.MOUSE_EXITED, event -> button1.setEffect(null));

        vBox.getChildren().add(button1);
        vBox.setSpacing(10);
        ((Group) scene.getRoot()).getChildren().add(vBox);
        primaryStage.setScene(scene);
        primaryStage.show();

    }

    public static void main(String[] args) {
        launch(args);
    }
}
